package com.engine.kq.cmd.report;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.kq.biz.*;
import com.engine.kq.util.ExcelUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.job.JobTitlesComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.systeminfo.SystemEnv;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.util.*;

public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {

  private HttpServletRequest request;
  private HttpServletResponse response;

  public ExportExcelCmd(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response, User user) {
    this.user = user;
    this.params = params;
    this.request = request;
    this.response = response;
  }

  @Override
  public Map<String, Object> execute(CommandContext commandContext) {
    Map<String, Object> retmap = new HashMap<String, Object>();
    RecordSet rs = new RecordSet();
    RecordSet rsCsd = new RecordSet();
    String sql = "";
    try {
      SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
      DepartmentComInfo departmentComInfo = new DepartmentComInfo();
      ResourceComInfo resourceComInfo = new ResourceComInfo();
      JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
      KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
      KQReportBiz kqReportBiz = new KQReportBiz();

      JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
      String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial"));
      String fromDate = Util.null2String(jsonObj.get("fromDate"));
      String toDate = Util.null2String(jsonObj.get("toDate"));
      String typeselect = Util.null2String(jsonObj.get("typeselect"));
      if (typeselect.length() == 0) typeselect = "3";
      if (!typeselect.equals("") && !typeselect.equals("0") && !typeselect.equals("6")) {
        if (typeselect.equals("1")) {
          fromDate = TimeUtil.getCurrentDateString();
          toDate = TimeUtil.getCurrentDateString();
        } else {
          fromDate = TimeUtil.getDateByOption(typeselect, "0");
          toDate = TimeUtil.getDateByOption(typeselect, "1");
        }
      }
      String subCompanyId = Util.null2String(jsonObj.get("subCompanyId"));
      String departmentId = Util.null2String(jsonObj.get("departmentId"));
      String resourceId = Util.null2String(jsonObj.get("resourceId"));
      String allLevel = Util.null2String(jsonObj.get("allLevel"));
      String isNoAccount = Util.null2String(jsonObj.get("isNoAccount"));
      String viewScope = Util.null2String(jsonObj.get("viewScope"));
      List<String> showColumns = Util.splitString2List(Util.null2String(jsonObj.get("showColumns")), ",");
      showColumns.add("lastname");
      showColumns.add("workcode");
      showColumns.removeIf(showColumn->showColumn.trim().equals(""));

      List<String> tmpShowColumns = new ArrayList<>();
      for(String showColumn:showColumns){
        tmpShowColumns.add(showColumn);
        String cascadekey = "";
        if(showColumn.equals("beLate")){
          cascadekey = "beLateMins";
        }else if(showColumn.equals("leaveEearly")){
          cascadekey = "leaveEarlyMins";
        }else if(showColumn.equals("graveBeLate")){
          cascadekey = "graveBeLateMins";
        }else if(showColumn.equals("graveLeaveEarly")){
          cascadekey = "graveLeaveEarlyMins";
        }else if(showColumn.equals("absenteeism")){
          cascadekey = "absenteeismMins";
        }else if(showColumn.equals("overtime")){
          tmpShowColumns.add("overtime_4leave");
          tmpShowColumns.add("overtime_nonleave");
          tmpShowColumns.add("workingDayOvertime_nonleave");
          tmpShowColumns.add("workingDayOvertime_4leave");
          tmpShowColumns.add("restDayOvertime_nonleave");
          tmpShowColumns.add("restDayOvertime_4leave");
          tmpShowColumns.add("holidayOvertime_4leave");
          tmpShowColumns.add("holidayOvertime_nonleave");
        }
        if(cascadekey.length()>0){
          tmpShowColumns.add(cascadekey);
        }
      }
      showColumns = tmpShowColumns;

      String rightSql = new KQReportBiz().getReportRight("1", "" + user.getUID(), "a");

      LinkedHashMap<String, Object> workbook = new LinkedHashMap<>();
      List<Object> lsSheet = new ArrayList<>();
      Map<String, Object> sheet = null;
      List<Object> titleList = new ArrayList<>();
      Map<String, Object> title = null;
      List<List<Object>> dataList = new ArrayList<>();
      List<Object> data = null;
      List<Map<String, Object>> constraintList = null;

      sheet = new HashMap<>();
      sheet.put("sheetName", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
      sheet.put("sheetTitle", SystemEnv.getHtmlLabelName(390351, user.getLanguage()));
      boolean isEnd = false;
      Calendar cal = DateUtil.getCalendar();

      List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
      Map<String, Object> mapChildColumnInfo = null;
      List<Object> childColumns = null;
      KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
      while (kqReportFieldComInfo.next()) {
        if (Util.null2String(kqReportFieldComInfo.getParentid()).length() > 0) continue;
        if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))
          continue;
        if (!showColumns.contains(kqReportFieldComInfo.getFieldname())&&!showColumns.contains(kqReportFieldComInfo.getParentid())) continue;
        if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
          continue;
        }
        title = new HashMap<>();
        String unitType = KQReportBiz.getUnitType(kqReportFieldComInfo, user);
        if(unitType.length()>0){
          title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())+ "(" + unitType + ")");
        }else{
          title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()));
        }
        title.put("width", 30 * 256);
        mapChildColumnInfo = this.getChildColumnsInfo(kqReportFieldComInfo.getFieldname(), user);
        childColumns = (List<Object>) mapChildColumnInfo.get("childColumns");
        if (childColumns.size() > 0) {//跨列width取子列的width
          title.put("children", childColumns);
          title.put("colSpan", childColumns.size());
        } else {
          title.put("rowSpan", 3);
        }
        titleList.add(title);
      }

      String today = DateUtil.getCurrentDate();
//      if (DateUtil.compDate(today, toDate) > 0) {//结束如期不大于今天
//        toDate = today;
//      }

      if(showColumns.contains("kqCalendar")) {
        childColumns = new ArrayList<>();
        for (String date = fromDate; !isEnd; ) {
          if (date.equals(toDate)) isEnd = true;
          title = new HashMap<>();
          title.put("title", DateUtil.geDayOfMonth(date));
          title.put("width", 30 * 256);
          childColumns.add(title);
          cal.setTime(DateUtil.parseToDate(date));
          date = DateUtil.getDate(cal.getTime(), 1);
        }

        title = new HashMap();
        title.put("title", SystemEnv.getHtmlLabelName(386476, user.getLanguage()));
        if (childColumns.size() > 0) {//跨列width取子列的width
          title.put("children", childColumns);
          title.put("colSpan", childColumns.size());
        }
        titleList.add(title);
      }
      sheet.put("titleList", titleList);



      String backFields = " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,b.subcompanyid,b.departmentid,b.jobtitle," +
              " sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," +
              " sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " +
              " sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," +
              " sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " +
              " sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " +
              " sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck) as forgotCheck ";
      if(rs.getDBType().equals("oracle")){
        backFields = 	"/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields;
      }
      String sqlFrom = " from hrmresource a, kq_format_total b where a.id= b.resourceid and b.kqdate >='" + fromDate + "' and b.kqdate <='" + toDate + "'";
      String sqlWhere = rightSql;
      String groupBy = " group by a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,b.subcompanyid,b.departmentid,b.jobtitle ";
      if (subCompanyId.length() > 0) {
        sqlWhere += " and b.subcompanyid in(" + subCompanyId + ") ";
      }

      if (departmentId.length() > 0) {
        sqlWhere += " and b.departmentid in(" + departmentId + ") ";
      }

      if (resourceId.length() > 0) {
        sqlWhere += " and b.resourceid in(" + resourceId + ") ";
      }

      if (viewScope.equals("4")) {//我的下属
        if (allLevel.equals("1")) {//所有下属
          sqlWhere += " and a.managerstr like '%," + user.getUID() + ",%'";
        } else {
          sqlWhere += " and a.managerid=" + user.getUID();//直接下属
        }
      }
      if (!"1".equals(isNoAccount)) {
        sqlWhere += " and a.loginid is not null " + (rs.getDBType().equals("oracle") ? "" : " and a.loginid<>'' ");
      }


      String orderBy = " order by a.dsporder asc, a.lastname asc ";
      String descOrderBy = " order by a.dsporder desc, a.lastname desc ";
      sql = "select " + backFields + sqlFrom + sqlWhere + groupBy + orderBy;

      //System.out.println("start" + DateUtil.getFullDate());
      Map<String, Object> flowData = new KQReportBiz().getFlowData(params, user);
      //System.out.println("end" + DateUtil.getFullDate());
      rs.execute(sql);
      while (rs.next()) {
        data = new ArrayList<>();
        kqReportFieldComInfo.setTofirstRow();
        String id = rs.getString("id");
        while (kqReportFieldComInfo.next()) {
          String fieldName = kqReportFieldComInfo.getFieldname();
          if (!Util.null2String(kqReportFieldComInfo.getIsdataColumn()).equals("1")) {
            continue;
          }
          if (!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month")){
            continue;
          }
          if (!showColumns.contains(kqReportFieldComInfo.getFieldname()) && !showColumns.contains(kqReportFieldComInfo.getParentid())){
            continue;
          }
          if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0){
            continue;
          }

          String fieldValue = "";
          if (fieldName.equals("subcompany")) {
            String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid"));
            if (tmpSubcompanyId.length() == 0) {
              tmpSubcompanyId = Util.null2String(resourceComInfo.getSubCompanyID(id));
            }
            fieldValue = subCompanyComInfo.getSubCompanyname(tmpSubcompanyId);
            fieldValue = subCompanyComInfo.getSubcompanyRealPath(tmpSubcompanyId,"/","0");
          } else if (fieldName.equals("department")) {
            String tmpDepartmentId = Util.null2String(rs.getString("departmentid"));
            if (tmpDepartmentId.length() == 0) {
              tmpDepartmentId = Util.null2String(resourceComInfo.getDepartmentID(id));
            }
            fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId);
            fieldValue = departmentComInfo.getDepartmentRealPath(tmpDepartmentId,"/","0");
          } else if (fieldName.equals("jobtitle")) {
            String tmpJobtitleId = Util.null2String(rs.getString("jobtitle"));
            if (tmpJobtitleId.length() == 0) {
              tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id));
            }
            fieldValue = jobTitlesComInfo.getJobTitlesname(tmpJobtitleId);
          } else if (fieldName.equals("attendanceSerial")) {
            List<String> serialIds = null;
            if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
              serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
            }
            for(int i=0;serialIds!=null&&i<serialIds.size();i++){
              data.add(kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i)));
            }
            continue;
          } else if (fieldName.equals("leave")) {//请假
            List<Map<String, Object>> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules();
            Map<String, Object> leaveRule = null;
            for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) {
              leaveRule = allLeaveRules.get(i);
              String flowType = Util.null2String("leaveType_" + leaveRule.get("id"));
              String leaveData = Util.null2String(flowData.get(id+"|"+flowType));
              String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id"));
              String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0");
              String flowLeaveData = Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0));
              data.add(flowLeaveData);
            }
            continue;
          }else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave")
              ||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){
            if (fieldName.equals("overtimeTotal")) {
              double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave")));
              workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave;
              double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave")));
              restDayOvertime_4leave = restDayOvertime_4leave<0?0:restDayOvertime_4leave;
              double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave")));
              holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave;

              double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave")));
              workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave;
              double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave")));
              restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave;
              double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave")));
              holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave;

              fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+
                  workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave));
            } else {
              fieldValue = Util.null2String(flowData.get(id + "|" + fieldName));
            }
          }else if(fieldName.equals("attendance")){
              //2.增加出勤率字段。计算规则为：出勤率=实际出勤天数/应出勤天数。

              try {
                  //应出勤天数 "workdays"
                  float fltWorkdays = Util.getFloatValue(rs.getString("workdays"));
                  //实际出勤天数 "attendancedays"
                  float fltAttendancedays = Util.getFloatValue(rs.getString("attendancedays"));
                  DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
                  fieldValue = df.format(fltAttendancedays/fltWorkdays);
              } catch (Exception e) {
                  e.printStackTrace();
              }

          } else if(fieldName.equals("salaryrange")){
              //3.增加工资范围字段。
              //数据来源为通过人员卡片自定义字段“工资核算范围”在建模表中匹配BPM工资核算范围，查询出“工资核算范围”显示到考勤报表中。例如人员卡片工资核算范围是A201，则可在建模表中查询出工资核算范围为A2。

              try {
                  rsCsd.executeQuery("select gzhsfw from uf_gzfw where id = (select field23 from cus_fielddata c join hrmresource h on c.id = h.id where h.id = ? and  c.scopeid='1')",id);
                  rsCsd.next();
                  fieldValue = Util.null2String(rsCsd.getString("gzhsfw"));

              } catch (Exception e) {
                  e.printStackTrace();
              }

          } else {
            fieldValue = Util.formatMultiLang(Util.null2String(rs.getString(fieldName)),""+user.getLanguage());
            if (Util.null2String(kqReportFieldComInfo.getUnittype()).length() > 0) {
              if (fieldValue.length() == 0) {
                fieldValue = "0";
              } else {
                if (kqReportFieldComInfo.getUnittype().equals("2")) {
                  fieldValue = KQDurationCalculatorUtil.getDurationRound(("" + (Util.getDoubleValue(fieldValue) / 60.0)));
                }
              }
            }
          }
          fieldValue = Util.formatMultiLang(fieldValue,""+user.getLanguage());
          data.add(fieldValue);
        }
        if(showColumns.contains("kqCalendar")) {
          Map<String, Object> detialDatas = kqReportBiz.getDetialDatas(id, fromDate, toDate, user);
          isEnd = false;
           for (String date = fromDate; !isEnd; ) {
            if (date.equals(toDate)) isEnd = true;
            if (DateUtil.compDate(today, date) > 0) {
              data.add("");
            } else {
              if (detialDatas.get(id + "|" + date) != null) {
                data.add(((Map<String, Object>) detialDatas.get(id + "|" + date)).get("text"));
              } else {
                data.add(SystemEnv.getHtmlLabelName(26593, user.getLanguage()));
              }
            }
            cal.setTime(DateUtil.parseToDate(date));
            date = DateUtil.getDate(cal.getTime(), 1);
          }
        }
        dataList.add(data);
      }
      sheet.put("dataList", dataList);
      sheet.put("constraintList", constraintList);
      sheet.put("createFile", "1");
      lsSheet.add(sheet);

      workbook.put("sheet", lsSheet);
      //String fileName = SystemEnv.getHtmlLabelName(390351, user.getLanguage());
      //workbook.put("fileName", fileName);
      ExcelUtil ExcelUtil = new ExcelUtil();
      Map<String, Object> exportMap = ExcelUtil.export(workbook, request, response);
      retmap.putAll(exportMap);
      retmap.put("status", "1");
    } catch (Exception e) {
      retmap.put("status", "-1");
      retmap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
      writeLog(e);
    }
    return retmap;
  }

  private Map<String, Object> getChildColumnsInfo(String parentid, User user) {
    Map<String, Object> returnMap = new HashMap<>();
    List<Object> titleList = new ArrayList<>();
    Map<String, Object> title = null;
    if (parentid.equals("attendanceSerial")) {//考勤班次
      KQShiftManagementComInfo kqShiftManagementComInfo = new KQShiftManagementComInfo();
      JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data")));
      List<String> serialIds = null;
      if (Util.null2String(jsonObj.get("attendanceSerial")).length() > 0) {
        serialIds = Util.splitString2List(Util.null2String(jsonObj.get("attendanceSerial")), ",");
      }
      for (int i = 0; serialIds != null && i < serialIds.size(); i++) {
        title = new HashMap<>();
        title.put("title", kqShiftManagementComInfo.getSerial(serialIds.get(i)));
        title.put("width", 30 * 256);
        titleList.add(title);
      }
    } else if (parentid.equals("leave")) {
      KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz();
      List<Map<String, Object>> leaveRules = kqLeaveRulesBiz.getAllLeaveRules();
      for (int i = 0; leaveRules != null && i < leaveRules.size(); i++) {
        Map<String, Object> leaveRule = leaveRules.get(i);
        String name = Util.formatMultiLang(Util.null2String(leaveRule.get("name")),""+user.getLanguage());
        String unitType = Util.null2String(leaveRule.get("unitType"));
        String unitName = unitType.equals("3") ? SystemEnv.getHtmlLabelName(391, user.getLanguage()) : SystemEnv.getHtmlLabelName(1925, user.getLanguage());
        title = new HashMap<>();
        title.put("title", name + "(" + unitName + ")");
        title.put("width", 30 * 256);
        titleList.add(title);
      }
    }else if(parentid.equals("overtime")){
      String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"};
      for(int i=0;i<overtimeChild.length;i++){
        String id = overtimeChild[i];
        title = new HashMap();
        String fieldlabel = "";
        if("overtime_nonleave".equalsIgnoreCase(id)){
          fieldlabel = "125805";
          title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
          title.put("rowSpan","2");
        }else if("overtime_4leave".equalsIgnoreCase(id)){
          fieldlabel = "125804";
          title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage()));
          title.put("rowSpan","2");
        }else{
          fieldlabel = "523";
          title.put("showDetial","1");
          String unitType = KQOvertimeRulesBiz.getMinimumUnit()==3?"2":"1";
          String unitTypeName = "";
          if(Util.null2String(unitType).length()>0){
            if(unitType.equals("1")){
              unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage());
            }else if(unitType.equals("2")){
              unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage());
            }else if(unitType.equals("3")){
              unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage());
            }
          }
          title.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())+ "(" + unitTypeName + ")");
        }

        Map<String,Object> mapChildColumnInfo = getChildColumnsInfo(id, user);
        int childWidth = 65;
        List<Object> childColumns = (List<Object>)mapChildColumnInfo.get("childColumns");
        if(childColumns.size()>0) {//跨列width取子列的width
          title.put("children", childColumns);
          childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65);
        }
        title.put("width", childWidth+"");
        titleList.add(title);
      }
    } else {
      KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo();
      while (kqReportFieldComInfo.next()) {
        if (kqReportFieldComInfo.getParentid().equals(parentid)) {
          title = new HashMap<>();
          title.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage()) + "(" + KQReportBiz.getUnitType(kqReportFieldComInfo, user) + ")");
          title.put("width", 30 * 256);
          titleList.add(title);
        }
      }
    }
    returnMap.put("childColumns", titleList);
    return returnMap;
  }

  @Override
  public BizLogContext getLogContext() {
    return null;
  }
}
